function submitCheckWithWX(_this){
    var tel=$(_this).find("input[name=uphone]").val();
    var telreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
    if(telreg.test(tel)){
        return true;
    }
    telreg = /^[a-zA-Z]([-_a-zA-Z0-9]{5,19})+$/;
    if(telreg.test(tel)){
        return true;
    }
    $(_this).find("input[name=uphone]").focus();
    alert("请准确填写手机或微信号");
    return false;
}


function submitCheck(_this){
  var tel=$(_this).find("input[name=uphone]").val();
  var telreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
  if(!telreg.test(tel)){
    alert("请准确填写手机号码");
    $(_this).find("input[name=uphone]").focus();
    return false
  }
}

function getCurrentMonthLast(){
    var date= new Date();
    var currentMonth=date.getMonth();
    var nextMonth=++currentMonth;
    var nextMonthFirstDay=new Date(date.getFullYear(),nextMonth,1);
    var oneDay=1000*60*60*24;
    var lastTime = new Date(nextMonthFirstDay-oneDay);
    var month = parseInt(lastTime.getMonth()+1);
    var day = lastTime.getDate();
    var yf =date.getMonth()+1;
    if (month < 10) {
        month = '0' + month
    }
    if (day < 10) {
        day = '0' + day
    }
    $('.month-m').text(month);
    $('.day-m').text(day);
    $('.year-m').text(date.getFullYear());
    $('.year-m-1').text(date.getFullYear()-1);
    $('.year-m2').text(date.getFullYear()+1);
    if(yf>=6){
      $('.sxn-m').text("下半年");
    }else{
      $('.sxn-m').text("上半年");
    }
}

if(typeof(myIp) == "undefined"){
    var myIp = '';
}
if(typeof(returnCitySN) != "undefined"){
  myIp = returnCitySN['cip'];
}

$(function(){
var date = new Date();
var y = date.getFullYear();
var M = date.getMonth()+1;
var d = date.getDate();
var h = date.getHours();
var m = date.getMinutes();
$('.usource').val(window.location.href);
$('.update').val(y+'年'+M+'月'+d+'日'+' '+h+'时'+m+'分');
$('.uip').val(myIp);
getCurrentMonthLast();
});


function doSomeOperation(){
  meteor.track("form", {convert_id: "1664748607619086"})
}

var submitCheckAjax = function(_this){
  var form = $(_this);
  var tel= form.find("input[name=uphone]").val();
  var telreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
  if(!telreg.test(tel)){
    alert("请准确填写手机号码");
    form.find("input[name=uphone]").focus();
    return false;
  }
  var url = form.attr('action');
  var action = form.find("input[name=action]").val();
  var diyid = form.find("input[name=diyid]").val();
  var do1 = form.find("input[name=do]").val();
  var Testsms = form.find("input[name=Testsms]").val();
  var uip = form.find("input[name=uip]").val();
  var usource = form.find("input[name=usource]").val();
  var update = form.find("input[name=update]").val();
  var dede_fields = form.find("input[name=dede_fields]").val();
  var dede_fieldshash = form.find("input[name=dede_fieldshash]").val();
  var uname = form.find("input[name=uname]").val();
  var udiploma = form.find("[name=udiploma]").val();
  var uage = form.find("[name=uage]").val();
  var upurpose = form.find("[name=upurpose]").val();
  var uway = form.find("[name=uway]").val();
  var uphone = tel;
  var data = {action,diyid,'do':do1,Testsms,uip,usource,update,dede_fields,dede_fieldshash,uname,udiploma,uage,upurpose,uway,uphone};
  doSomeOperation()
  $.ajax({
    url:url,
    data:data,
    type:"GET",
    dataType:"jsonp",
    success: function(data) {
      alert("提交成功！");
    },
    error:function(data) {
      alert("提交成功！");
    } 
  })
  return false;
}